/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package rockpaperscissors;
import java.util.Scanner;

/**
 *
 * @author Anne
 */
public class RockPaperScissors {

    /**
     * @param args the command line arguments
     */
        public static int WinnerPlayer1(String player1, String player2)
    {
        if(player1.equals("R") && player2.equals("S"))
        {
            System.out.println("Player 1 Wins");
        }
        else if(player1.equals("P") && player2.equals("R"))
        {
            System.out.println("Player 1 Wins");
        }
        else if(player1.equals("S") && player2.equals("P"))
        {
            System.out.println("Player 1 Wins");
        }
        return 1;
    }



    public static void main(String[] args) {
        String p1, p2 = null,c;
        int computer;
        Scanner keyboard  = new Scanner (System.in);
        boolean noWinner = true;
        boolean playAgain = true;
        
        System.out.println("Player 1");
        System.out.println("Enter C to play against the computer or enter O to play against another opponent");
        c = keyboard.next();
        c = c.toUpperCase();
        System.out.println("Please enter your choice for the Rock-Paper-Scissors Game:");
        System.out.println("R: rock");
        System.out.println("P: paper");
        System.out.println("S: scissors");
        System.out.println("Paper covers rock, Rock breaks scissors, Scissors cut paper!!");
        
        p1 = keyboard.next();
        p1 = p1.toUpperCase();
        
        //playing against a computer
        if(c.equals("C"))
        {
            computer = (int)(3*Math.random())+1;
            switch(computer)
            {
                case 1:
                {
                    p2 = "R";  
                }
                case 2:
                {
                    p2 = "P";
                }
                case 3:
                {
                    p2 = "S";
                }             
            }            
        }
        else
        {
        System.out.println("Player 2");
        System.out.println("Please enter your choice for the Rock-Paper-Scissors Game:");
        System.out.println("R: rock");
        System.out.println("P: paper");
        System.out.println("S: scissors");
        System.out.println("Paper covers rock, Rock breaks scissors, Scissors cut paper!!");
        
        p2 = keyboard.next();
        p2 = p2.toUpperCase();
        }
        //Method call to check if player 1 wins. 
        
        
        if(WinnerPlayer1(p1,p2) == 1)
        {
            noWinner = false;
        }
        //Method call to check if player 2 wins
        //No Winner to the game - automatic replay
        
    }
            
}
